<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body {
            height: 4000px;
        }
        .box1 {
            position: relative;
            margin: 200px auto;
            width: 200px;
            height: 200px;
            background-color: lightblue;
        }
        .box2 {
            position: absolute;
            top: 400px;
            left: 100px;
            width: 100px;
            height: 100px;
            background-color: red;
        }
        .box3 {
            position: fixed;
            top: 0;
            right: 0;
            width: 200px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="box1">
            <div class="box2">

            </div>
    </div>
    <div class="box3">

    </div>
</body>
</html>